<html>
<head><meta charset="utf-8"><title>tracing to stderr · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html">tracing to stderr</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206362723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206362723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206362723">(Aug 08 2020 at 20:23)</a>:</h4>
<p>Is there a way to get tracing output to stderr?</p>



<a name="206362727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206362727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206362727">(Aug 08 2020 at 20:23)</a>:</h4>
<p>instead of stdout</p>



<a name="206364062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206364062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206364062">(Aug 08 2020 at 21:06)</a>:</h4>
<p>is this a question about how to change the integration of tracing in the compiler?</p>



<a name="206364072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206364072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206364072">(Aug 08 2020 at 21:07)</a>:</h4>
<p>in that case, <a href="https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/fmt/trait.MakeWriter.html"><code>MakeWriter</code></a> can help.</p>



<a name="206364111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206364111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206364111">(Aug 08 2020 at 21:08)</a>:</h4>
<p>though I don’t know if rustc is using tracing-subscriber.</p>



<a name="206364116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206364116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206364116">(Aug 08 2020 at 21:08)</a>:</h4>
<p>no, just about how to switch this at runtime / using an env flag or something</p>



<a name="206364177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206364177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206364177">(Aug 08 2020 at 21:10)</a>:</h4>
<p>I doubt there's a way to switch this at runtime. You could redirect but that would affect all of the stdout outputs in general, not just tracing stuff.</p>



<a name="206368141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206368141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> teor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206368141">(Aug 08 2020 at 23:07)</a>:</h4>
<p>We had a similar problem in Zebra, which we couldn't solve because we were using an Abscissa component which used Stdout for MakeWriter.</p>
<p>But if you're using tracing-subscriber directly, you should be able to change the MakeWriter to Stderr based on an env var.</p>
<p>The tracing parts of this ticket might help:<br>
<a href="https://github.com/ZcashFoundation/zebra/issues/667">https://github.com/ZcashFoundation/zebra/issues/667</a></p>



<a name="206368185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/tracing%20to%20stderr/near/206368185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> teor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/tracing.20to.20stderr.html#206368185">(Aug 08 2020 at 23:08)</a>:</h4>
<p>(I think tracing-subscriber should use Stderr by default, but that would be a breaking change.)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>